package atest.reopen.xml.enum1;

import atest.model.StudentStatus;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class StudentStatusHandler implements TypeHandler<StudentStatus> {

	@Override
	public void setParameter(PreparedStatement ps, int i, StudentStatus parameter, JdbcType jdbcType) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public StudentStatus getResult(ResultSet rs, String columnName) throws SQLException {
		return StudentStatus.getStudentStatus(rs.getString(columnName));
	}

	@Override
	public StudentStatus getResult(ResultSet rs, int columnIndex) throws SQLException {
		return StudentStatus.getStudentStatus(String.valueOf(rs.getInt(columnIndex)));
	}

	@Override
	public StudentStatus getResult(CallableStatement cs, int columnIndex) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}
	
}
